package hapi.mvc;

class Display {

	public static function list( elements:List<Displayable>, ?prefix:String=null):List<Dynamic> {
		var list = new List<Dynamic>();
		var hasPrefix = prefix != null;
		for ( d in elements) {
			var dynamicView:DynamicView  = new DynamicView();
			if (hasPrefix)
				d.displayOn(new Subview(dynamicView, prefix));
			else
				d.displayOn(dynamicView);
			list.add(dynamicView.getContext());
		}
		return list;
	}
}